﻿<div class="sponsor-message agent">
    <div class="title mt20">
        <div class="clearfix">
            <h2>最新代理官任务</h2>
            <a href="javascript:void(0)">more</a>
        </div>
    </div>
    <div class="sponsor-message-main">
        <div class="wrap sponsorWrap" id="sponsorWrap">
            <ul id="spon-ul1">
                <li ng-repeat="x in names">
                    <p class="main-color">{{x.ProjectName}}</p>
                    <span>赞助金额</span><span class="main-color">￥{{x.Amount}}元 </span>
                    <p>{{x.CreatorName}}</p>
                    <p>{{x.ContractorName}}</p>
                    <p>代理官：<span class="main-color">{{x.AgentName}}</span></p>
                    <p>活动时间：<time>{{x.StartDate | date:'yyyy/MM/dd'}}</time>-<time>{{x.EndDate | date:'yyyy/MM/dd' }}</time></p>
                </li>
            </ul>
            <ul id="spon-ul2"></ul>
        </div>
    </div>
</div>
<script>

    var PAGE = {
        scrollView: function (speed, firstId, secondId, thirdId) {
            //速度设置
            var speed = speed;
            var colee2 = document.getElementById(thirdId);
            var colee1 = document.getElementById(secondId);
            var colee = document.getElementById(firstId);
            if(colee1.offsetHeight <= colee.offsetHeight) return false;//子元素高度小于父元素，足够容纳子元素，不用轮播

            colee2.innerHTML = colee1.innerHTML; //克隆colee1为colee2
            function Marquee1() {
                //当滚动至colee1与colee2交界时
                if (colee2.offsetTop - colee.scrollTop <= 0) {
                    colee.scrollTop -= colee1.offsetHeight; //colee跳到最顶端
                } else {
                    colee.scrollTop++
                }
            }
            var MyMar1 = setInterval(Marquee1, speed) //设置定时器
            //鼠标移上时清除定时器达到滚动停止的目的
            colee.onmouseover = function () {
                clearInterval(MyMar1)
            }
            //鼠标移开时重设定时器
            colee.onmouseout = function () {
                MyMar1 = setInterval(Marquee1, speed)
            }
        }
    }

    $(function(){
        //右边滚动栏
        setTimeout(function(){
            PAGE.scrollView(20, 'sponsorWrap', 'spon-ul1', 'spon-ul2'); 
            if (common.checkValue($("#scrollView")[0]))
            PAGE.scrollView(30, 'scrollView', 'scrollV-wrap1', 'scrollV-wrap2'); 
        },100)
    });
      
    //中部滚动栏
    //PAGE.scrollView(50, 'scrollingNew', 'scrollingNew1', 'scrollingNew2');

</script>
